<template>
  <div class="component">
    <div v-if="content.value==='1'">
    <button class="buttonClass"><span>下一章</span></button>
    </div>
    <div v-if="content.value==='2'">
      <div class="unlockChapter">
        <span class="wordContainer">解锁章节</span>
        <span class="chapterNameContainer">{{content.nextChapterName}}</span>
      </div>
      </div>
  </div>
</template>

<script lang="ts">
import {defineComponent, PropType, watch, ref} from 'vue';
export default defineComponent({
  name: 'Chapter',
  props: {
    id: {
      type: String as PropType<string>,
      default: "0000"
    },
    valueFromParent: {
      type: Object as PropType<Object>,
      required: true,
      default: {}
    },
  },
  setup(props) {
    const content = ref(props.valueFromParent.moduleValue );
    watch(()=>props.valueFromParent,(newVal)=>{
      content.value = newVal.moduleValue
    },{deep:true})
    return{
      content
    }
  }

});

</script>

<style scoped>
  .unlockChapter {
    display: flex;
    margin-left: 20px;  /* 解锁章节距离左边10px */
    margin-top: 10px;    /* 解锁章节距离上面8px */
    margin-bottom: 10px;
  }
  .unlockChapter span {
    margin-right: 50px; /* 两个元素之间的距离为100px */
    left: 61.17px;
    top: 1653.34px;
    opacity: 1;
    /** 文本1 */
    font-size: 16.18px;
    font-weight: 400;
    letter-spacing: 0px;
    line-height: 24.27px;
    color: rgba(145, 145, 145, 1);
    text-align: left;
    vertical-align: top;

  }

  .unlockChapter span:last-child {
    margin-right: 0; /* 最后一个元素不需要右边距 */
    left: 168.5px;
    top: 1653.34px;
    opacity: 1;
    /** 文本1 */
    font-size: 16.18px;
    font-weight: 400;
    letter-spacing: 0px;
    line-height: 24.27px;
    color: rgba(255, 255, 255, 1);
    text-align: center;
    vertical-align: top;

  }
.component {
  .buttonClass{
    left: 28px;
    top: 2184.31px;
    width: 320px;
    height: 46px;
    opacity: 1;
    border-radius: 25px;
    background: rgba(255, 141, 26, 1);
    margin-top: 8px;
    margin-left: 11px;
    span{
      left: 161px;
      top: 2195.31px;
      width: 54px;
      height: 24px;
      opacity: 1;
      /** 文本1 */
      font-size: 18px;
      font-weight: 500;
      letter-spacing: 0px;
      line-height: 23.87px;
      color: rgba(28, 28, 28, 1);
      text-align: center;
      vertical-align: top;
      margin-top: 13px;
    }
  }
  /* 样式 */
  color: white;
  border: 1px solid #ff8d1a;
  width: 345px;
  min-height: 40px;
  margin-top: 20px;
  background-color: #232323;
  border-radius: 10px;
  overflow:hidden;
  .video_container{
    padding-top: 20px;
    padding-bottom: 20px;
    padding-left: 108px;
    img{
      border-radius: 10px;
      width: 7.99px;
      height: 9.08px;
    }
  }

}
</style>
